Sam Thiel

Mathematics and Games

I've been obsessed with the mathematics that comes out of various games for a long time; games, in many ways, mimic the structure of mathematics, in that you provide a simple set of rules and then the game itself is an emergent pheonmenon of those axioms.

This is a list of a variety of mathematical problems or curiosities that I've (started to) compile in one place.

Mora Jai Boxes — Blue Prince

This problem contains spoilers for the puzzle game Blue Prince, including spoilers for the second "layer" of the game.

In the game Blue Prince, you will occasionally come across a kind of mini-puzzle called a Mora Jai box (named after one of the fictional locations in game). This game, at its most basic level, is a variation of the game Lights Out; the first puzzle you find is precisely this on a 3x3 grid, using only white and gray tiles. The solution to this first puzzle is to put a white tile in all four corners, as opposed to making the whole grid lit up.

However, as you get further into the game, you discover more and more colors of tiles. Yellow and Purple tiles come next, which simply shift up and shift down (respectively) when you click them. Pink tiles cycle the tiles around them. Green tiles reflect themselves across the center of the grid. The complexity continues.

There are ten colors in total: White, Gray, Black, Red, Yellow, Purple, Green, Pink, Orange, and finally, Blue. Each has its own unique effect. It's worth reading through the Blue Prince Wiki page on Mora Jai boxes to understand each of the colors. Regardless of the colors on the box, the solution to the puzzle is to put four tiles of a (prescribed) color into the four corners of the 3x3 grid.

There are two kinds of questions that feel natural to ask, both inspired by questions related to solving Rubik's Cubes:

  • Given a starting state of the puzzle, can you identify if the puzzle is solvable?
  • How long can a "perfect" solution to a Mora Jai box be? That is, given perfect play, what is the most convoluted you can make the solution?
  • The first question is interesting because its fairly easy to construct a puzzle which is unsolvable. Three yellow tiles in the top row, three white in the center row, and three purple in the bottom row is a puzzle that cannot be solved, regardless of what the solution color is meant to be. The second question is asking for "God's Number" of Mora Jai boxes as a whole. The simulator below has an example ("Benchmark 5") of a puzzle which generates an 84 move solution, according to the solver (though, I'm unsure if this is optimal).

    On the linked wiki page above, there is a Mora Jai box solver which I have not explored in depth, but is a useful tool for investigating these questions: https://joric.github.io/blueprince/.

    This site was last updated in May 2026. It was created using Jekyll with interactive components running on p5.js. The layout for this website was given to me by Alexander N. Wilson, who helped me set up this site.